package com.guigu.pd.auth.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.guigu.pd.auth.entity.AuthMenuEntity;
import com.guigu.pd.auth.service.AuthMenuService;
import com.guigu.common.utils.PageUtils;
import com.guigu.common.utils.R;



/**
 * 
 *
 * @author deyran
 * @email deyran@gmail.com
 * @date 2022-07-19 19:05:57
 */
@RestController
@RequestMapping("auth/authmenu")
public class AuthMenuController {
    @Autowired
    private AuthMenuService authMenuService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("auth:authmenu:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = authMenuService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("auth:authmenu:info")
    public R info(@PathVariable("id") Long id){
		AuthMenuEntity authMenu = authMenuService.getById(id);

        return R.ok().put("authMenu", authMenu);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("auth:authmenu:save")
    public R save(@RequestBody AuthMenuEntity authMenu){
		authMenuService.save(authMenu);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("auth:authmenu:update")
    public R update(@RequestBody AuthMenuEntity authMenu){
		authMenuService.updateById(authMenu);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("auth:authmenu:delete")
    public R delete(@RequestBody Long[] ids){
		authMenuService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
